package extendsDemo2;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 阿宾
 * Date: 2025-03-11
 * Time: 13:17
 */
class C{
    public void method1(){
        System.out.println("C类中的method1方法");
    }
    public void method2(){
        System.out.println("C类中的method2方法");
    }
}
class B extends C{
    @Override
    public void method2(){
        System.out.println("B类中的method2方法");
    }
}
class A extends C{
    @Override
    public void method2(){
        System.out.println("A类中的method2方法");
    }
}
public class Test2 {
    public static void main(String[] args) {
        A a = new A();
        a.method1();
        a.method2();

        B b = new B();
        b.method1();
        b.method2();
    }
}
